package com.twf.a01test;

import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        System.out.println("输入n的值");
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long sum = 0;
        int wei = 1;
        for (int i = 1; i <= n; i++) {
            wei *= i;
            sum += wei;
        }
        if (sum == 1) {
            System.out.println(1);
        }

            System.out.println(sum);
    }
}
